package com.wandian.weather.adapter;


import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mylib.libcore.bean.LocalCityBean;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.weather.R;

public class WeatherCityStreeRecycleAdapter extends BaseQuickAdapter<LocalCityBean, BaseViewHolder> {

    private int selectItem=-1;
    public WeatherCityStreeRecycleAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, LocalCityBean item) {
        TextView tv_city_name = helper.getView(R.id.tv_city_name);
        if(!UIUtils.isEmpty(item))tv_city_name.setText(item.getName()+"");
        ImageView iv_city_select = helper.getView(R.id.iv_city_select);
        iv_city_select.setVisibility(View.GONE);
        if(helper.getLayoutPosition()==selectItem)iv_city_select.setVisibility(View.VISIBLE);
    }
    public void notifySelectItemView(int item){
        this.selectItem = item;
        notifyDataSetChanged();
    }
}
